﻿namespace Sharp.Portal.Mvc
{
    /// <summary>
    /// 显示字段和值字段的配置
    /// </summary>
    /// <remarks>
    /// 视图模型设置：
    /// [Display(Name = "角色"), DisplayValueField("Title", "Id")]
    /// public IList<RoleDTO> Roles { get; set; }
    /// 
    /// 然后Controller 里给Roles赋值List
    /// </remarks>
    public class DisplayValueFieldAttribute : System.Attribute
    {
        public DisplayValueFieldAttribute(string displayField, string valueField, string dataSourceName = "")
        {
            DisplayField = displayField;
            ValueField = valueField;
            DataSourceName = dataSourceName;
        }
        public string DisplayField { get; set; }
        public string ValueField { get; set; }
        public string DataSourceName { get; set; }
    }

}
